package com.lhoverc.utils;
import java.util.Random;

/**
 * @Author: LiCheng
 * @CreateTime: 2025-04-27
 * @Description:
 * @Version: 1.0
 */

class CodeGeneratorUtil {
    private static final String CHAR_SET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    private static final Random RANDOM = new Random();

    public static String generateCode(int length) {
        StringBuilder code = new StringBuilder();
        for (int i = 0; i < length; i++) {
            int randomIndex = RANDOM.nextInt(CHAR_SET.length());
            code.append(CHAR_SET.charAt(randomIndex));
        }
        return code.toString();
    }
}
